//*********************************************************
// Subroutine for calculating vertex point light
//   diffuse and specular component
//
// define SHIFT to select shift for current point light data
//
// Output Registers used:
//   to r5 added diffuse color
//   to r6 added specular color
//
//*********************************************************

// Point light
#include "_attenuation_point.vsh"
//r0 - normalized vertex to light vector
//r1.w  - attenuation

dp3 r4.x, r0, inNormal		//r4.x = L * N

//calculating half-vector( vertex to light vector + eye vector )
add r3, r0, r7			//r3 = half-vector
dp3 r3.w, r3, r3
rsq r3.w, r3.w
mul r3, r3, r3.w

dp3 r4.y, r3, inNormal		//r4.y = H * N
lit r3, r4

//scale by attenuation
mul r3, r3, r1.w

//calculating diffuse
mad r5.xyz, r3.y, c[SHIFT + VL_PLIGHT_DIFFUSE_1], r5

//calculating specular
mad r6, r3.z, c[SHIFT + VL_PLIGHT_SPECULAR_1], r6
